﻿using System;
using System.Collections.Generic;
using System.Text;
using Cn.Edwon.Biz;
using Cn.Cellula.Model;
using System.Xml;
using System.Web.UI.WebControls;
using Cn.Cellula.Model.System;

namespace Cn.Cellula.Biz.Port {
    public interface ICategoryBiz:IBiz {

        TSysCategoryEO LoadByName(String rName,String rTypeKey,String rOwnerKey); 
        /// <summary>
        /// 根据父ID获取分类列表
        /// </summary>
        /// <param name="parentKey"></param>
        /// <returns></returns>
        IList<TSysCategoryEO> LoadCategories(String rOwnerKey,String rTypeKey,String parentKey);
        /// <summary>
        /// 将分类列表转换为json格式
        /// </summary>
        /// <param name="list"></param>
        /// <returns></returns>
        String LoadCategory2Json(String rOwnerKey, String rTypeKey, String parentKey);
        /// <summary>
        /// 将分类中从某个节点开始以下子孙都转换为json数据
        /// </summary>
        /// <param name="node"></param>
        /// <returns></returns>
        String ParseNode2Json(XmlNode node);
        /// <summary>
        /// 将分类转化为优结构的xml格式
        /// </summary>
        /// <param name="firstId"></param>
        /// <returns></returns>
        XmlDocument LoadCatalog2XHtml(String rOwnerKey, String rTypeKey, String parentKey);
        /// <summary>
        /// 将分类转化为下拉列表的集合
        /// </summary>
        /// <param name="rPrefix">层级菜单的前缀字符串</param>
        /// <param name="rSelfKey">自身节点ID，在选择时列表将过滤掉自己</param>
        /// <param name="rSelected"></param>
        /// <returns></returns>
        IList<ListItem> LoadCatalog2ListItem(String rOwnerKey, String rTypeKey, String rPrefix, String rSelfKey, Boolean rSelected);
        /// <summary>
        /// 将分类转化为下拉列表的集合
        /// </summary>
        /// <param name="rDoc"></param>
        /// <param name="rPrefix">层级菜单的前缀字符串</param>
        /// <param name="rSelfKey">自身节点ID，在选择时列表将过滤掉自己</param>
        /// <param name="rSelected"></param>
        /// <returns></returns>
        IList<ListItem> LoadCatalog2ListItem(XmlDocument rDoc,String rPrefix,String rSelfKey,Boolean rSelected);
        /// <summary>
        /// 获取当前分类的Path
        /// </summary>
        /// <param name="rDoc"></param>
        /// <param name="rCategoryId"></param>
        /// <returns></returns>
        IList<TSysCategoryEO> LoadCategoryPath(String rOwnerKey, String rTypeKey, String rCategoryId);
        IList<TSysCategoryEO> LoadCategoryPath(XmlDocument doc, String rCategoryId);
        /// <summary>
        /// 获取当前分类的Path
        /// </summary>
        /// <param name="rDoc"></param>
        /// <param name="rCategoryId"></param>
        /// <returns></returns>
        String LoadCategoryPath(String rOwnerKey, String rTypeKey, String rCategoryId, String rSeparate);
        /// <summary>
        /// 删除分类
        /// </summary>
        /// <param name="rKeys"></param>
        void DeleteCategories(String[] rKeys, String rOwnerKey);
        /// <summary>
        /// 删除分类
        /// </summary>
        /// <param name="rKeys"></param>
        void DeleteCategories(IList<String> rKeys, String rOwnerKey);
        /// <summary>
        /// 获取子孙节点的ID集合
        /// </summary>
        /// <param name="rOwnerKey"></param>
        /// <param name="rTypeKey"></param>
        /// <param name="rKey"></param>
        /// <returns></returns>
        IList<String> LoadDescendantsKeys(String rOwnerKey, String rTypeKey, String rKey);

        string LoadCategory2JskitMenuXml(String rTypeKey, String rUrl, Boolean rAllOption, String rAllText);
        /// <summary>
        /// 将category列表转换成JskitRichDropDownList使用json数据
        /// </summary>
        /// <param name="rOwnerKey"></param>
        /// <param name="rTypeKey"></param>
        /// <param name="parentKey"></param>
        /// <returns></returns>
        String LoadCategory2JskitDdl(String rOwnerKey, String rTypeKey, String parentKey);
        /// <summary>
        /// 将eo转换成JskitRichDropDownList使用json数据
        /// </summary>
        /// <param name="node"></param>
        /// <returns></returns>
        String ParseNode2JskitDdlItem(XmlNode node);
   }
}
